package o;

import com.huawei.appmarket.service.deamon.bean.DownloadHistory;
import java.util.List;

public final class dsw {
    public static final String ˊ = DownloadHistory.class.getSimpleName();
    private static final Object ˋ = new Object();
    private static dsw ˏ = null;
    public cfu ˎ = euc.ˊ().ʽ(ˊ);

    private dsw() {
    }

    public static dsw ˋ() {
        dsw o_dsw;
        synchronized (ˋ) {
            if (ˏ == null) {
                ˏ = new dsw();
            }
            o_dsw = ˏ;
        }
        return o_dsw;
    }

    public List<DownloadHistory> ˊ() {
        return this.ˎ.ˋ(DownloadHistory.class, null);
    }

    public DownloadHistory ˏ(String str) {
        List<DownloadHistory> ˋ = this.ˎ.ˋ(DownloadHistory.class, "packageName_=?", new String[]{str}, null, null);
        if (!ˋ.isEmpty()) {
            for (DownloadHistory downloadHistory : ˋ) {
                int ʽ = downloadHistory.ʽ();
                if (10 != ʽ && 9 != ʽ) {
                    return downloadHistory;
                }
            }
        }
        return null;
    }

    public void ॱ(String str) {
        this.ˎ.ˋ("packageName_=?", new String[]{str});
    }

    public void ˊ(long j) {
        this.ˎ.ˋ("sessionId_=?", new String[]{j + ""});
    }

    public void ॱ(DownloadHistory downloadHistory) {
        int ʽ = downloadHistory.ʽ();
        if (ʽ == 9 || ʽ == 10) {
            this.ˎ.ˎ((cfr) downloadHistory);
            return;
        }
        if (this.ˎ.ॱ(downloadHistory, "packageName_=?", new String[]{String.valueOf(downloadHistory.ˋ())}) == 0) {
            this.ˎ.ˎ((cfr) downloadHistory);
        }
    }

    public void ˋ(DownloadHistory downloadHistory) {
        this.ˎ.ॱ(downloadHistory, "packageName_=?", new String[]{String.valueOf(downloadHistory.ˋ())});
    }
}
